char = 'asd'
if char == 'azx':
    print('\n相等')
    print(char == 'asd')
else:
    print('\n不相等')
    print(char == 'zxc')

a = 'Audi'
a.lower() == 'audi'
print(a == a.lower())

a = 1
b = 2
if a == b:
    print("相等")
else:
    print("不相等")

a = 1
b = 2
if a >= b:
    print("相等")
else:
    print("不相等")


print("\nif-elif-else语句")
age = 20
if age < 4:
    print("Your admission cost is $0.")
elif age < 18:
    print("Your admission cost is $5.")
else:
    print("Your admission cost is %10.")

#代码优化
age = 10
if age < 4:
    price = 0
elif age < 18:
    price = 5
else:
    price = 10
print("Your admission cost is $" + str(price) + '.\n')


#if语句和if-elif-else的区别，如果你只想使用一行代码执行，你就用if-elif-else。如果是需要多行代码执行还是用独立的if
#topping.py
request_tooping = ['mushrooms', 'extra cheese']
if 'mushrooms' in request_tooping:
    print("Adding mushrooms")
if 'pepperoni' in request_tooping:
    print("Adding pepperoni")
if 'extra cheese' in request_tooping:
    print("Adding extra cheese")
print("\nFinished making your pizza!\n")

#外星人小游戏
alien_color = ['green', 'yellow', 'red']
if 'green' in alien_color:
    print("恭喜你获得5积分")

#未通过版本
if 'green' == alien_color:
    print("恭喜你获得5积分")

#5-4-1
if 'green' in alien_color:
    print("因射杀外星人获得5积分\n")
elif 'yellow' in alien_color:
    print("玩家获得10积分")
elif 'red' in alien_color:
    print("玩家获得15积分")

#5-4-2
if 'white' in alien_color:
    print("因射杀外星人获得5积分")
elif 'yellow' in alien_color:
    print("玩家获得10积分\n")
elif 'red' in alien_color:
    print("玩家获得15积分")

#5-4-3
if 'white' in alien_color:
    print("因射杀外星人获得5积分")
elif 'white' in alien_color:
    print("玩家获得10积分")
elif 'red' in alien_color:
    print("玩家获得15积分\n")
#版本2
if 'white' in alien_color:
    print("因射杀外星人获得5积分")
else:
    print("玩家获得10积分")

#5-6 人生的不同阶段
print("\n")

age = 23
if age < 2:
    print("婴儿")
elif age >= 2 and age < 4:
    print("蹒跚学步")
elif age >= 4 and age < 13:
    print("儿童")
elif age >= 13 and age < 20:
    print("青少年")
elif age >= 20 and age < 65:
    print("成年人")
elif age >= 65:
    print("老年人")


#5-7 喜欢的水果
print("\n favorite_fruits.py\n")

fruits = ['apple', 'bananas', 'orange', 'strawberry', 'watermelon']
if 'apple' in fruits:
    print("Your really like apple!")
if 'bananas' in fruits:
    print("Your really like bananas!")
if 'orange' in fruits:
    print("Your really like orange!")
if 'strawberry' in fruits:
    print("Your really like strawberry!")
if 'watermelon' in fruits:
    print("Your really like watermelon!")